/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vn.ac.aptech.fat1.c0910g.dao;

import vn.ac.aptech.fat1.c0910g.entity.User;

/**
 *
 * @author NDC
 */
public interface UserDAO {
    /**
     *  Add new User.
     *  @param u the object contain all information of user.
     *  @return true if add successfully or false if not
     *  @throws Throws Exception if have any error.
     */
    public boolean createUser(User u) throws Exception;

    /**
     *  Update user
     *  @param u the object contain all information of user. (Must have older ID)
     *  @return true if update successfully or false if not
     *  @throws Throws Exception if have any error.
     */
    public boolean updateUser(User u) throws Exception;

    /**
     *  Delete user
     *  @param u the object User (Must have ID)
     *  @return true if delete successfully or false if not
     *  @throws Throws Exception if have any error.
     */
    public boolean deleteUser(User u) throws Exception;

    /**
     *  valid login which username & password
     *  @param username
     *  @param password
     *  @return the User object have information if login successfully.
     *  Return null if no User found.
     *  @throws Throws Exception if have any error.
     */
    public User doLogin(String username, String password) throws Exception;
}
